package com.zy.mobile.message.push.netty.chapter12.domain;

import java.util.HashMap;
import java.util.Map;

/**
 * netty消息头
 * @author zhangyi
 *
 */
public class Header {
	
	private int crcCode = 0xabef0101;//netty消息验证码 通过固定的0xabef这两个字节 标示是特殊的消息 然后后两个字节 代表主版本号和次版本号
	
	private int length;//消息长度
	
	private long sessionId;//会话Id
	
	private byte type;//消息类型
	
	private byte priority;//消息优先级
	
	private Map<String,Object> attachment = new HashMap<String,Object>();//可扩展数据

	public int getCrcCode() {
		return crcCode;
	}

	public void setCrcCode(int crcCode) {
		this.crcCode = crcCode;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public long getSessionId() {
		return sessionId;
	}

	public void setSessionId(long sessionId) {
		this.sessionId = sessionId;
	}

	public byte getType() {
		return type;
	}

	public void setType(byte type) {
		this.type = type;
	}

	public byte getPriority() {
		return priority;
	}

	public void setPriority(byte priority) {
		this.priority = priority;
	}

	public Map<String, Object> getAttachment() {
		return attachment;
	}

	public void setAttachment(Map<String, Object> attachment) {
		this.attachment = attachment;
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "Header [crcCode=" + crcCode + ", length=" + length + ", sessionId=" + sessionId + ", priority=" 
				+ priority + ", attachment=" + attachment + "]";
	}
	
}
